package com.jin.webvideo.config.filter.access.rule;

import com.jin.webvideo.config.filter.access.GlobalStore;
import com.jin.webvideo.config.filter.access.handler.AccessHandler;
import com.jin.webvideo.entity.SessionStore;

import javax.servlet.http.HttpServletRequest;

/**
 * 非访问规则
 *
 * @author biao532
 * @date 2023/12/04 18:12
 **/
public class NotAccessRule implements AccessHandler.AccessRule {
    private AccessHandler.AccessRule orign;

    public NotAccessRule(AccessHandler.AccessRule orign) {
        this.orign = orign;
    }

    public void setOrign(AccessHandler.AccessRule orign) {
        this.orign = orign;
    }

    @Override
    public boolean compute(GlobalStore globalStore, SessionStore store, HttpServletRequest request) {
        return !this.orign.compute(globalStore, store, request);
    }
}
